package com.longcheer.weibo;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;

public class ExitConfirmDialog {
    
    private AlertDialog.Builder mDialogBuilder;
    private AlertDialog mExitConfirm;
    
    public ExitConfirmDialog(final Activity activity) {
        mDialogBuilder = new AlertDialog.Builder(activity);
        mExitConfirm = mDialogBuilder.setTitle(R.string.exit_confirm_title)
            .setMessage(R.string.exit_confirm_msg)
            .setPositiveButton(R.string.exit_weibo, new OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    mExitConfirm.dismiss();
                    activity.finish();
                }
            }).setNegativeButton(R.string.exit_cancel, new OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    mExitConfirm.dismiss();
                }
            })
            .setCancelable(true)
            .create();
    }
    
    public void show() {
        mExitConfirm.show();
    }
}
